import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isLogin: sessionStorage.getItem('user') ? 1 : 0,
    user: sessionStorage.getItem('user') ? JSON.parse(sessionStorage.getItem('user')) : {}
  },
  mutations: {
    loginOK(state, payload) {
      state.isLogin = 1
      state.user = payload
    },
    exit(state) {
      state.isLogin = 0
    }
  },
  actions: {
  },
  modules: {
  }
})
